package com.bjsxt.controller;


import com.bjsxt.pojo.Menu;
import com.bjsxt.pojo.PageResult;
import com.bjsxt.pojo.Result;
import com.bjsxt.pojo.Role;
import com.bjsxt.service.IRoleMenuService;
import com.bjsxt.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-02-22
 */
@Controller
@RequestMapping("/role")
public class RoleController {
    //声明业务层属性
    @Autowired
    private IRoleService roleService;
    //声明单元方法：加载角色信息
    @ResponseBody
    @RequestMapping("roleInfo")
    public PageResult<Role> roleInfo(Integer page,Integer rows){
        //处理请求
        PageResult<Role> pageResult=roleService.selectRoleInfo(page,rows);
        //做出响应
        return pageResult;
    }
    //声明单元方法：增加角色信息
    @ResponseBody
    @RequestMapping("roleAdd")
    public Result roleAdd(String mids,Role role){
        //处理请求
        Result result=roleService.insertRoleInfoService(mids,role);
        //响应结果
        return result;
    }
    //声明单元方法：修改角色信息
    @ResponseBody
    @RequestMapping("roleModify")
    public Result roleModify(String mids,Role role){
        //处理请求
        Result result=roleService.updateRoleInfoService(mids,role);
        //响应结果
        return result;
    }
    @ResponseBody
    @RequestMapping("roleDelete")
    public Result roleDelete(String rids){
        //处理请求
        Result result=roleService.deleteRoleInfoService(rids);
        //响应结果
        return result;
    }
}

